
<@override name="title">我的个人信息修改</@override>
<@override name="content">

<div class="os-main clearfix">
    <#include "user_nav.html" >

    <div class="setting-right">
        <div class="setting-title">
            <strong>我的个人信息修改</strong>
        </div>
        <div class="split-line" style="margin: 20px 0px;"></div>

        <form id="uinfoForm" method="post" action="${base}/saveinfo" >
            <div class="form-group clearfix">
                <label class="control-label left-label"></label>
                <div class="col-sm-4">
                    <#if (authUser.header)?? && authUser.header != ''>
                    <img id="imagePreview" style="height:96px;width:96px;background-image:url('/file/attachment/${authUser.header}/s');background-size:contain;">
                    <#else>
                    <img id="imagePreview" style="display:none;height:96px;width:96px;background-size:contain;">
                    </#if>
                <input type="file" id="file" style="margin-top:3px;">
                </div>
                <input type="hidden" id="userHeader" name="userHeader" value="" />
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">登录名</label>
                <div class="col-sm-4 vercial-label"><span>${(authUser.username)!"user001"}</span></div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">姓名</label>
                <div class="col-sm-4">
                    <input name="realname"  value="${(authUser.realname)!}" type="text"  class="form-control">
                </div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">性别</label>
                <div class="col-sm-4">
                    <select class="form-control" name="gender">
                        <option value="1" <#if (authUser.gender)?? && authUser.gender == 1> selected="selected"</#if> >男</option>
                        <option value="0" <#if (authUser.gender)?? && authUser.gender == 0> selected="selected"</#if> >女</option>
                </select>
                </div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">学历</label>
                <div class="col-sm-4">
                    <select class="form-control" name="education">
                        <option value="本科" <#if (authUser.education)?? && authUser.education == '本科'> selected="selected"</#if>>本科</option>
                        <option value="硕士" <#if (authUser.education)?? && authUser.education == '硕士'> selected="selected"</#if>>硕士</option>
                        <option value="博士" <#if (authUser.education)?? && authUser.education == '博士'> selected="selected"</#if>>博士</option>
                        <option value="博士后" <#if (authUser.education)?? && authUser.education == '博士后'> selected="selected"</#if>>博士后</option>
                        <option value="大专" <#if (authUser.education)?? && authUser.education == '大专'> selected="selected"</#if>>大专</option>
                    </select>
                </div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">手机号</label>
                <div class="col-sm-4">
                    <input name="mobile" class="form-control" value="${(authUser.mobile)!}"  type="number" >
                </div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">qq</label>
                <div class="col-sm-4">
                    <input name="qq" class="form-control" value="${(authUser.qq)!}"  type="text" >
                </div>
            </div>

            <div class="form-group clearfix">
                <label class="control-label left-label">微信</label>
                <div class="col-sm-4">
                    <input name="wechat"  value="${(authUser.wechat)!}"  type="text"  class="form-control">
                </div>
            </div>

            <div id="_alertInfo" class="alert-info" style="display:none"></div>

            <div class="form-group clearfix" style="margin-top:30px;">
                <label class="control-label left-label"></label>
                <input type="button" class="modal-btn modal-btn-bg" value="保 存" onclick="doSubmit()"/>
            </div>
        </form>

    </div>

</div>

<script type="text/javascript">
    //选择图片的时候
    $('#file').change(function(evt){
        let f = $('#file').val();//获取文件的名字
        if(_os.photoValid(f)){
            let file = $('#file').get(0).files[0];//获取文件本身
            _os.processImageFile(file,function(r){
                $('#imagePreview').css('background-image','url('+r.image+')');
                $('#imagePreview').show();
                $('#userHeader').val(r.data);
            })
        }else{
            _os.alertMsg('图片格式不正确');
        }
    })

    function doSubmit() {
        $('#uinfoForm').ajaxSubmit({
            dataType:'json',
            success: function(resp){
                if(resp.errcode == 0){
                    _os.alertMsg("保存成功")
                }else{
                    _os.alertMsg("保存失败")
                }
            }
        })
    }
</script>

</@override>
<@extends name="_base.html" />